import java.util.Scanner;

public class Main1718 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int a=n/1000;//1
        int b=(n/100)%10;//2
        int c=(n%100)/10;//3
        int d=n%10;//4
        int max=0;
        if (n>999&&n<10000&&a>b)
            max=a;
        else max=b;
        if (c>max)
            max=c;
        if (d>max)
            max=d;
        System.out.println(max);

    }
}
